package com.yhkj.data.mq.message;

import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.yhkj.data.jackson.SyncMessageDeserializer;
import com.yhkj.data.mq.enums.JdbcMessageEnum;
import lombok.Data;

import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.io.Serializable;

/**
 * @author <a href="mailto:idler41@163.con">linfuxin</a> created on 2023-03-03 20:26:44
 */
@Data
@JsonDeserialize(using = SyncMessageDeserializer.class)
public class SyncMessage implements Serializable {

    /**
     * 数据源配置
     */
    @NotNull
    @Valid
    private DataSourceConfig dataSourceConfig;

    /**
     * 表配置信息
     */
    @NotNull
    @Valid
    private TableMetaData tableMetaData;

    /**
     * 同步数据(行、列结构二维数组)
     *
     * @see JdbcMessageEnum 序列化、反序列化参考
     */
    @NotNull
    @Size(min = 1)
    private Object[][] data;
}
